/**
 *
 */
package cn.dw.mm.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.dw.mm.domain.Problem;
import cn.dw.mm.service.ProblemService;

/**
 * @author aubrey
 * @date  下午2:40:24
 * 
 */
@Controller
@RequestMapping(value="/problem")
public class ProblemController {
	
	@Autowired
	private ProblemService problemService;
	
	@RequestMapping(value="/selectByProblemId")
	@ResponseBody
	public List<Problem> selectByProblemId(Integer id) {
		return problemService.selectByProblemId(id);
	}

	@RequestMapping(value="/selectByCondition" , method=RequestMethod.POST)
	@ResponseBody
	public List<Problem> selectByCondiction(Problem problem) {
		return problemService.selectByCondiction(problem);
	}
	
	@RequestMapping(value="/delete")
	@ResponseBody
	public int deleteById(Integer id) {
		return problemService.deleteById(id);
	}

	@RequestMapping(value="/insert" , method=RequestMethod.POST)
	@ResponseBody
	public int insert(Problem problem) {
		return problemService.insert(problem);
	}

	@RequestMapping(value="/update" , method=RequestMethod.POST)
	@ResponseBody
	public int update(Problem problem) {
		return problemService.update(problem);
	}

}
